//
//  MarketCoinModel.swift
//  Exchange
//
//  Created by rui on 2018/6/27.
//  Copyright © 2018年 common. All rights reserved.
//

import UIKit

class MarketCoinModel: NSObject {

    ///名字
    var name: String = ""
    ///24h量
    var vol: Double = 0
    ///当前价格
    var price: Double = 0
    ///法币价格
    var money: Double = 0
    ///开盘价
    var open: Double = 0
    var high: Double = 0
    var low: Double = 0
    
    ///时间戳
    var ts: Double = 0
    
    var amount: Double = 0
    

    override init() {
        super.init()
    }
    
    func encode(with aCoder: NSCoder) {
        aCoder.encode(name, forKey: "name")
        aCoder.encode(vol, forKey: "vol")
        aCoder.encode(price, forKey: "price")
        aCoder.encode(money, forKey: "money")
        aCoder.encode(open, forKey: "open")
        aCoder.encode(ts, forKey: "ts")
        aCoder.encode(amount, forKey: "amount")
    }
    
    required init?(coder aDecoder: NSCoder) {
        if let name = aDecoder.decodeObject(forKey: "name") as? String {
            self.name = name
        }
        if let vol = aDecoder.decodeObject(forKey: "vol") as? Double {
            self.vol = vol
        }
        if let price = aDecoder.decodeObject(forKey: "price") as? Double {
            self.price = price
        }
        if let money = aDecoder.decodeObject(forKey: "money") as? Double {
            self.money = money
        }
        if let open = aDecoder.decodeObject(forKey: "open") as? Double {
            self.open = open
        }
        if let ts = aDecoder.decodeObject(forKey: "ts") as? Double {
            self.ts = ts
        }
        if let amount = aDecoder.decodeObject(forKey: "amount") as? Double {
            self.amount = amount
        }
    }
    
}
